summaryrefslogtreecommitdiffstats
path: root/rust/wolfree_sed_in_place/src/include_str.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'rust/wolfree_sed_in_place/src/include_str.tsx')
-rw-r--r--rust/wolfree_sed_in_place/src/include_str.tsx71
1 files changed, 71 insertions, 0 deletions
diff --git a/rust/wolfree_sed_in_place/src/include_str.tsx b/rust/wolfree_sed_in_place/src/include_str.tsx
new file mode 100644
index 0000000..3c8ff4e
--- /dev/null
+++ b/rust/wolfree_sed_in_place/src/include_str.tsx
@@ -0,0 +1,71 @@
+/**
+ * @license
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ * This file is part of Wolfree.
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ */
+
+// @ts-check
+
+const wolfreeLexicalScopeName = (() => {
+ const possibleLetters = Array();
+
+ for (let i = 32; i < 127; i++) {
+ possibleLetters.push(String.fromCharCode(i));
+ }
+
+ const possibleNames = possibleLetters.flatMap((x) =>
+ possibleLetters.map((y) => x + y)
+ );
+
+ const isValid = (name = String()) => {
+ try {
+ return (
+ typeof eval(name).value === "string" &&
+ typeof eval(name).i2d === "boolean"
+ );
+ } catch (error) {
+ return false;
+ }
+ };
+
+ const wolfreeLexicalScopeName = possibleNames.find(isValid);
+
+ if (typeof wolfreeLexicalScopeName !== "string") {
+ console.error({ wolfreeLexicalScopeName });
+ return "";
+ }
+
+ return wolfreeLexicalScopeName;
+})();
+
+(() => {
+ const get = (params = String()) => {
+ return new URLSearchParams(location.search).get(params);
+ };
+
+ eval(wolfreeLexicalScopeName).value = get("i") || "topic mathematics";
+ eval(wolfreeLexicalScopeName).i2d = get("i2d") === "true";
+})();
+
+/**
+ * Regex in regex - Rust
+ * https://docs.rs/regex/latest/regex/struct.Regex.html#replacement-string-syntax
+ * All instances of $ref in the replacement string are replaced with the substring corresponding to the capture group identified by ref.
+ * ref may be an integer corresponding to the index of the capture group (counted by order of opening parenthesis where 0 is the entire match) or it can be a name (consisting of letters, digits or underscores) corresponding to a named capture group.
+ */
+// @ts-ignore
+$0;
+
+(async () => {
+ (
+ await import(
+ // @ts-ignore
+ "../../../ajax/libs/wolfree/23.7.8/js/Entrypoint.js"
+ )
+ ).default({
+ input: eval(wolfreeLexicalScopeName).value,
+ i2d: eval(wolfreeLexicalScopeName).i2d,
+ extraPodstates: [],
+ });
+})();